home *** CD-ROM | disk | FTP | other *** search
/ Games Central GT Digital… Q3 Premier Trimestre '98 / GT_DPK.ISO / pc / data / menu.dxr / 00046_Scroll Indicator behavior.ls < prev    next >
Encoding:
Text File  |  1995-08-25  |  1.5 KB  |  49 lines

  1. property pIndicatorLowerLimit, pIndicatorRange, pClickedStatus, pCurrentSprite
  2.  
  3. on beginSprite me
  4.   set pCurrentSprite to the spriteNum of me
  5.   set spacing to 3
  6.   set offset to (the height of sprite pCurrentSprite / 2) + spacing
  7.   set trackSprite to pCurrentSprite - 1
  8.   set trackSpriteTop to the top of sprite trackSprite
  9.   set pIndicatorLowerLimit to trackSpriteTop + offset
  10.   set trackSpriteBottom to the bottom of sprite trackSprite
  11.   set indicatorUpperLimit to trackSpriteBottom - offset
  12.   set pIndicatorRange to indicatorUpperLimit - pIndicatorLowerLimit
  13.   set the locV of sprite pCurrentSprite to pIndicatorLowerLimit
  14. end
  15.  
  16. on positionIndicator me, textRatio
  17.   set currentPosition to pIndicatorRange * textRatio
  18.   set indicatorPosition to currentPosition + pIndicatorLowerLimit
  19.   set the locV of sprite pCurrentSprite to indicatorPosition
  20. end
  21.  
  22. on mouseDown me
  23. end
  24.  
  25. on exitFrame me
  26.   if the mouseDown and (the clickOn = pCurrentSprite) then
  27.     scrollTextWithIndicator(me, the mouseV)
  28.   end if
  29. end
  30.  
  31. on scrollTextWithIndicator me, mouseVertical
  32.   set nextPosition to mouseVertical
  33.   if nextPosition < pIndicatorLowerLimit then
  34.     set nextPosition to pIndicatorLowerLimit
  35.   else
  36.     set upperLimit to pIndicatorLowerLimit + pIndicatorRange
  37.     if nextPosition > upperLimit then
  38.       set nextPosition to upperLimit
  39.     end if
  40.   end if
  41.   set ratioPosition to float(nextPosition - pIndicatorLowerLimit)
  42.   set ratio to ratioPosition / pIndicatorRange
  43.   sendAllSprites(#scrollText, ratio)
  44. end
  45.  
  46. on getIndicatorPosition me
  47.   return the locV of sprite pCurrentSprite
  48. end
  49.